perm filename LOADED.LSP[AID,LSP] blob
sn#652701 filedate 1982-04-10 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00002 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 HACKED BY HAND
C00008 ENDMK
C⊗;
;HACKED BY HAND
;These functions can load the SAIL line editor with the printed
;representations for lisp forms. Subsequent reads will return
;the line.
;(INITED) sets up a byte pointer in location BPTR to point at the first
;byte in the block at location EDBUFF. It also sets up location COUNT to
;contain -132 decimal and clears the input buffer.
;(ADDED F FLAG) "prints" the form F into EDBUFF, putting the first
;character into the byte pointed at by BPTR and leaving BPTR pointing at
;the byte after the last byte printed into. If FLAG is true then special
;characters are slashified, otherwise they are not. ADDED also increments
;COUNT everytime it deposits a byte. If the buffer ever overflows,
;whatever is in the current input buffer is left and ADDED returns nil.
;Otherwise, it returns t.
;(LOADED) puts a CR into EDBUFF at the place pointed to by BPTR, i.e. at
;the end of the current string. Then it calls the UUO which loads the line
;editor with the characters in EDBUFF and returns NIL. BPTR is not
;incremented after depositing the CR so that a subsequent call to ADDED
;will overwrite the CR, making the whole buffer available to be sent to the
;line editor (the UUO PTYLOAD stops at activation characters).
(LAP INITED SUBR)
(ARGS INITED (NIL . 0))
(MOVE TT (% (+ 350700000000 EDBUFF))) ;MAKE BPTR POINT AT THE FIRST
(MOVEM TT BPTR) ;7-BIT BYTE IN BLOCK AT EDBUFF
(MOVEI TT 132.)
(MOVNM TT COUNT) ;INITIALIZE COUNT TO -132
(051←33 11) ;CLEAR INPUT BUFFER: CLRBFI UUO
(MOVEI A 'NIL) ;RETURN NIL
(POPJ P)
(ENTRY ADDED SUBR)
(ARGS ADDED (NIL . 2))
(MOVEI R EDFUN) ;PRINTA TAKES IN R THE ADDRESS OF A
;ROUTINE TO WHICH IT PASSES CHARACTERS
(JUMPE B (+ * 2)) ;IF THE SIGN BIT IN R IS SET,
(HRLI R -1) ;PRINTA WILL SLASHIFY
(PUSHJ P PRINTA)
(AOSLE 0 COUNT) ;IF COUNT≥0 THEN OVERFLOW
(JRST 0 OVER)
(MOVEI A 'T) ;RETURN T IF SUCCEED
(POPJ P)
OVER
(MOVEI A 'NIL) ;RETURN NIL IF OVERFLOW
(POPJ P)
EDFUN ;PRINTA WILL CALL EDFUN WITH
(AOSL 0 COUNT) ;THE CHAR IN REG A. INCREMENT
(JRST 0 ND) ;COUNT AND GOTO ND IF ≥ 0.
(DPB A BPTR) ;ELSE DEPOSIT CHAR
(IBP 0 BPTR) ;AND INCREMENT POINTER
ND
(POPJ P) ;THIS IS PURELY AN INTERNAL ROUTINE,
;SO ITS OK TO RETURN GARBAGE.
(ENTRY LOADED SUBR)
(ARGS LOADED (NIL . 0))
(MOVEI TT 15) ;PUT CR AT END OF STRING
(DPB TT BPTR)
(711←33 15 (- EDBUFF 2)) ;THIS IS PTYLOAD EDBUFF - 2
(MOVEI A 'NIL) ;RETURN NIL
(POPJ P)
;DATA
COUNT (0)
BPTR (0)
;NEXT TWO WORDS ARE THOSE ADDRESSED BY PTYLOAD UUO
;THEY WERN'T LABELED BUT ADDRESSED AS EDBUFF - 2.
;THE FIRST SPECIFIES THE USER'S SCREEN AS THE TARGET LINE EDITOR
;THE SECOND IS A POINTER AT THE STRING TO LOAD IT WITH.
(0)
(0 0 EDBUFF)
EDBUFF (BLOCK 34)
NIL